﻿
namespace ServiceTests
{
    using System;

    using Moq;
    using NUnit.Framework;
    using ServiceInterfaces;
    using Services;
    using UnityRepository.Initializers;

    [TestFixture]
    public class DbConnectionInitializerServiceTests
    {
        private Mock<IDbConnectionInitializer> dbConnectionInitializer;

        private IDbConnectionInitializerService dbConnectionInitializerService;

        [SetUp]
        public void SetUp()
        {
            this.dbConnectionInitializer = new Mock<IDbConnectionInitializer>();
            this.dbConnectionInitializerService = new DbConnectionInitializerService(this.dbConnectionInitializer.Object);
        }

        [Test]
        public void WhenIWantToSetConnectionString_ItShouldBeSetToPassedString()
        {
            this.dbConnectionInitializerService.SetConnectionString(It.IsAny<String>());

            this.dbConnectionInitializer.Verify(db => db.SetConnectionString(It.IsAny<String>()), Times.AtLeastOnce);
        }
    }
}
